package org.example.demo4;

import cn.hutool.core.io.FileUtil;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;

/**
 * @author Gong.Yang
 */
public class TryDemo {
    public static void main(String[] args) {

        try (FileInputStream inputStream = new FileInputStream("filePath1");
             FileInputStream inputStream2 = new FileInputStream("filePath2");
        ) {
            System.out.println("执行完try语句，将会自动调用AutoCloseable.close()完成资源释放");
        } catch (IOException e) {
            throw new RuntimeException(e);
        }

    }
}
